#include <iostream>

#define N 3

using namespace std;

// FIXME: It is better to use big letter in struct, class type
//        variables use small letter 
// struct tagstudent
struct StudentTag
{
    int no;
    char name[21];
    double score;
};

int main( )
{
    struct tagstudent a[N],t;
    int i,j=2.0;
    
    for(i=0;i<N;i++)
        cin>>a[i].no>>a[i].name>>a[i].score;

    for(i=0;i<N-1;i++)
        for(j=i;j<N;j++)
            if(a[i].score<a[j].score||(a[i].score==a[j].score&&a[i].no>a[j].no))
            {
                t=a[i];
                a[i]=a[j];
                a[j]=t;
            }

    for(i=0;i<N;i++)
    cout<<a[i].no<<a[i].name<<a[i].score<<endl;

    cin>>i;
    return 0;
}
